import java.util.Map;
import java.util.Random;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;

public class GCTest{

    public static final Map<Integer,User> users = new ConcurrentHashMap<>();

    public static void main(String[] args){
        new Thread(()->{
            while(true){
                for (int i = 0; i < 30000; i++) {
                    Integer key = new Random().nextInt();
                    users.put(key,new User(key+""));
                }
                try {
                    TimeUnit.SECONDS.sleep(1L);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }).start();

        new Thread(()->{
            while(true){
                for (int i = 0; i < 10000; i++) {
                    Integer key = new Random().nextInt();
                    users.remove(key);
                }
                try {
                    TimeUnit.SECONDS.sleep(1L);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }).start();
    }
}

class User{
    private String name;

    public User(String name){
         this.name = name;
    }

}
